package main

import (
    "log"
    "net/http"
    "syscall"
    "math/rand"
    "time"
    "github.com/gin-gonic/gin"
    "github.com/fvbock/endless"
)

func main() {
    router := gin.Default()
    router.GET("/", func(c *gin.Context) {
        time.Sleep(5*time.Second)
        c.String(http.StatusOK,
            string(rand.Intn(100)))

    })

    server := endless.NewServer(":8090", router)
    server.BeforeBegin = func(add string) {
        log.Printf("Actual pid is %d", syscall.Getpid())
    }

    err := server.ListenAndServe()
    if err != nil {
        log.Printf("Server err: %v", err)
    }

}
